<%--
  Created by IntelliJ IDEA.
  User: git:jybdd - liming
  Date: 2019/9/30
  Time: 20:41
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>个人中心</title>
    <link rel="Shortcut Icon" href="../imgs/Kat-icon.png">
    <!-- 引入bootstrap框架的样式文件 -->
    <link rel="stylesheet" href="../plugins/bootstrap/css/bootstrap.css" type="text/css">
    <link type="text/css" href="../css/personal.css" rel="stylesheet" />
    <link rel="stylesheet" href="../css/head.css">
    <!-- fileinput theme -->
    <link rel="stylesheet" href="../css/file/fileinput.min.css">
    <script src="../js/ajaxfileupload.js"></script>
    <script src=" https://cdn.bootcss.com/jquery.form/4.2.2/jquery.form.js"></script>
    <style>
        .footer {
            background: url(<%=request.getContextPath()%>/imgs/foot.jpg) no-repeat center;
            background-size: cover;
            font-size: 12px;
            height: 200px;
        }

        .romve {
            padding-top: 40px;
            margin-left: 200px;
            color: white;
        }
    </style>
</head>
<body>
<!-- 导航开始 -->
<div>
    <div class="container-fluid">
        <div class="row" style="background-color:rgb(1,81,40)" >
            <ul class="nav navbar-nav navbar-right" style="padding-right: 20px;font-size: 10px;" id="head">
                <c:if test="${!empty user}">
                    <li><a href="#">欢迎&nbsp${user.username}!</a></li>
                    <li><a href="<%=request.getContextPath()%>/slogin/exit">安全退出</a></li>
                    <li><a href="<%=request.getContextPath()%>/personal/user">个人中心</a></li>
                </c:if>
                <c:if test="${empty user}">
                    <li><a href="<%=request.getContextPath()%>/cloginview">请登录!</a></li>
                </c:if>

            </ul>
        </div>
    </div>
    <div class="container">
        <div class="row">
            <ul class="nav navbar-nav" id="daohang"
                style="width: 100%">
                <li style="padding-top: 0px;">
                    <img src="<%=request.getContextPath()%>/imgs/logo1 .png" alt="" style="width: 60px; height:60px;">
                </li>
                <li><a href="<%=request.getContextPath()%>/index/into">
                    首页
                </a></li>
                <li><a href="<%=request.getContextPath()%>/reg/in">
                    预约挂号
                </a></li>
                <li><a href="<%=request.getContextPath()%>/firstdep/dep">
                    科室导航
                </a></li>
                <li><a href="<%=request.getContextPath()%>/science/science">
                    健康科普
                </a></li>
                <li><a href="<%=request.getContextPath()%>/medicine">
                    药品物价查询
                </a></li>
                <ul class="nav navbar-nav navbar-right">
                    <li style="padding-top: 10px;"><a href="<%=request.getContextPath()%>/index/mapTurn">医院位置导航<img src="<%=request.getContextPath()%>/imgs/地图.png"  style="width: 15px; margin-left:5px "></a></li>
                </ul>
            </ul>
        </div>
    </div>
</div>
<!-- 导航结束 -->

    <!-- 个人中心视图 -->
    <a name="per"></a>
    <div class="personal">
        <div class="container">
            <div class="row">
                <div class="col-xs-2 col-sm-2 col-md-2" id="left">
                    <div class="title">
                        <span>个人中心</span>
                    </div>
                    <div id="outer">

                        <!-- <div class="container-fluid"> -->
                        <ul id="tab" class="nav navbar-nav">
                            <li class="active"><span class="glyphicon glyphicon-user">&nbsp;我的信息</span></li>
                            <li><a href="${pageContext.request.contextPath}/personal/order"
                                   class="glyphicon glyphicon-list-alt">&nbsp;<span>挂号订单</span></a></li>
                            <li><a href="${pageContext.request.contextPath}/personal/record"
                                   class="glyphicon glyphicon-calendar">&nbsp;<span>就诊记录</span></a></li>
                            <li><a href="${pageContext.request.contextPath}/personal/medical"
                                   class="glyphicon glyphicon-tasks">&nbsp;<span>我的病历</span></a>
                            </li>
                            <li><a href="${pageContext.request.contextPath}/personal/safetys" class="glyphicon glyphicon-phone">&nbsp;<span>账号安全</span></a>
                            </li>
                            <li><a href="${pageContext.request.contextPath}/personal/newview" class="glyphicon glyphicon-tree-deciduous">&nbsp;<span>就诊管理</span></a>
                            </li>
                        </ul>


                    </div>
                </div>
                <div class="col-xs-9 col-sm-9 col-md-9" id="righter">
                    <div class="title">
                        <span><img src="${pageContext.request.contextPath}/imgs/weblogo.png" alt="" style="width: 2%">知医治</span>

                    </div>
                    <div id="content">
                        <div style="display:block;" class="tabpage">
                            <h3 class="glyphicon glyphicon-grain">我的信息</h3>
                            <div class="counts">
                                <div class="texts">
                                    <h4><b>实名认证:</b></h4>
                                </div>
                                <%--身份认证--%>

                                <div class="texts">
                                <div class="container">
                                    <div class="row">
                                        <div class="col-lg-6">
                                            <form method="post" enctype="multipart/form-data" id="imgform" >
                                            <div class="form-group">
                                                <input type="file" name="file_idcard" id="file2" class="file" multiple data-min-file-count="2">
                                            </div>
                                            </form>
                                        </div>
                                    </div>
                                </div>
                                </div>
                                <%--身份认证--%>
                                <c:if test="${empty sessionScope.userinfo}">
                                <div class="texts">
                                    <span id="upspan" style="color: red;margin-left: 400px"></span>
                                </div>
                                    <div class="texts">
                                        <span><b>真实姓名:</b></span>&nbsp;&nbsp;&nbsp;
                                        <span id="res_name"></span>
                                    </div>
                                    <div class="texts">
                                        <span><b>证件号码:</b></span>&nbsp;&nbsp;&nbsp;
                                        <span id="res_cardNumber"></span>
                                    </div>
                                    <div class="texts">
                                        <span><b>性别:</b></span>&nbsp;&nbsp;&nbsp;
                                        <span id="res_sex"></span>
                                    </div>
                                </c:if>
                                <div style="margin-left:35%;margin-top:100px;">
                                    <a href="<%=request.getContextPath()%>/personal/user"><span><button type="button" style="color:white;"><small>取消修改</small></button></span></a>
                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    <span><button type="button" onclick="qwe()" style="color:white;"><small>保存修改</small></button></span>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
<br>
<br>
<div class="footer">
    <div class="romve">
        <p>服务热线：1599999999</p>
        <P>医院地址：医院地址：北京市昌平区回龙观东大街308号</P>
        <p>Copyright © 2019 知医治 - 京卫网审[2016]第1927号 - 京ICP备13016643-6</p>
    </div>
</div>
    <!-- bootstrap中的js插件依赖于jquery框架,所以必须先引入jquery的js文件 -->
    <script src="../plugins/jquery/jquery.min.js"></script>
    <!--引入bootstrap的js文件-->
    <script src="../plugins/bootstrap/js/bootstrap.js"></script>
<!-- fileinput main js -->
<script src="../js/file/fileinput.min.js"></script>
<!-- chn language js -->
<script src="../js/file/zh.js"></script>
<script type="text/javascript" src="../js/ajaxfileupload.js"></script>
<script src=" https://cdn.bootcss.com/jquery.form/4.2.2/jquery.form.js"></script>
<script>
    $("#file2").fileinput({
        uploadUrl: 'http://localhost:8888/treatment/idCard',
        uploadAsync: false,
        allowedFileExtensions: ['jpg', 'png', 'gif'],
        //browseClass: "btn btn-primary", //按钮样式
        //maxFileSize:0,//单位为kb，如果为0表示不限制文件大小
        maxFileCount: 2,
        minFileCount: 2,
        layoutTemplates: {
            actionUpload: ''	//去掉略缩图中的上传按钮，去掉哪个就设置哪个
        },
        dropZoneTitle: '选择两张图片，第一张正面，第二张国徽面'
    }).on('filebatchuploadsuccess', function(event, data, previewId, index) {
        var res_b_arr = data.response.back;		//背面
        var res_f_arr = data.response.front;	//正面
        $('#res_name').text(res_f_arr.words_result.姓名.words);	//正面信息
        $('#res_sex').text(res_f_arr.words_result.性别.words);
        $('#res_bera').text(res_f_arr.words_result.出生.words);
        $('#res_nation').text(res_f_arr.words_result.民族.words);
        $('#res_address').text(res_f_arr.words_result.住址.words);
        $('#res_cardNumber').text(res_f_arr.words_result.公民身份号码.words);
        $('#res_start').text(res_b_arr.words_result.签发日期.words);		//背面信息
        $('#res_end').text(res_b_arr.words_result.失效日期.words);
        $('#res_office').text(res_b_arr.words_result.签发机关.words);
    });
</script>
<script type="text/javascript" language="JavaScript" >

    $('#file2').change( function() {
        $("#imgform").ajaxSubmit({
            url: "/treatment/test/upload",
            method: 'POST',
            datType: 'json',
            success: function (data) {
                console.log(data);
                if(data.imgUrl !=null){

                }
            },
            error: function (data) {

            }
        })
    })
</script>
<script>

    function qwe() {
        var resName = document.getElementById("res_name").innerHTML;
        var resCardNumber = document.getElementById("res_cardNumber").innerHTML;
        var resSex = document.getElementById("res_sex").innerHTML;
        var span = document.getElementById("upspan");

        if(resName == "" || resName == null){
            span.innerHTML="请先点击上传再保存"
            return false
        }


        location.href ="/treatment/personal/initup?resName="+resName+"&resCardNumber="+resCardNumber+"&resSex="+resSex;

    }
    $("#submit").click(function () {
        var resName = document.getElementById("res_name").innerHTML;
        var resCardNumber = document.getElementById("res_cardNumber").innerHTML;
        var resSex = document.getElementById("res_sex").innerHTML;



        $.ajax({
            url:"/treatment/personal/initup",
            data:{resName:resName,resCardNumber:resCardNumber,resSex:resSex},
            async:true,
            cache:false,
            type:"POST",
        })
    });
</script>
</body>

</html>